package com.wawu.server.dao;

import com.wawu.common.annotation.IOC.component.Repository;
import com.wawu.common.utils.SQLBuilder.SelectSQLBuilder;
import com.wawu.common.utils.SQLExcutorUtil;
import com.wawu.pojo.entity.Admin;

import java.sql.SQLException;
import java.util.List;

@Repository
public class AdminsDAO {

    /**
     * 动态条件查询用户
     * @param adminQuery
     * @return
     */
    public List<Admin> getAdmin(Admin adminQuery) throws SQLException {
        SelectSQLBuilder selectSQLBuilder=new SelectSQLBuilder("admins")
                .addDynamicCondition("account","=",adminQuery.getAccount())
                .addDynamicCondition("pwd","=",adminQuery.getPwd());
        return SQLExcutorUtil.queryList(selectSQLBuilder.getSQL(),Admin.class,selectSQLBuilder.getParams());
    }
}

